// javamaps
// Copyright (c) 2010 Bebeselea Elena
package Data;
import Core.*;
import java.util.*;
import java.io.*;

public class ImageLayer implements ILayer, Serializable{
    private ObjectId ID_;
    private int zoomLevels_;
    private Coordinates start_;
    private Coordinates end_;
    private List<ZoomInfo> levels_;

    /*
     * Constructori.
     */
    public ImageLayer(){
        ID_ = new ObjectId(0);
        zoomLevels_ = 0;
        start_ = new Coordinates(0, 0);
        end_ = new Coordinates(0, 0);
        levels_ = new ArrayList<ZoomInfo>();
    }
    
    public ImageLayer(ObjectId ID, int zoomLevels, Coordinates start, Coordinates end){
        ID_ = ID;
        zoomLevels_ = zoomLevels;
        start_ = start;
        end_ = end;
        levels_ = new ArrayList<ZoomInfo>();
    }
   
    /*
     * Metode publice.
     */
    public void SetID(ObjectId ID){ ID_ = ID; }

    public int ZoomLevels(){ return levels_.size(); }

    public Coordinates Start(){ return start_; }
    public void SetStart(Coordinates start){  start_ = start;}

    public Coordinates End(){ return end_; }
    public void SetEnd(Coordinates end){ end_ = end; }

    public List<ZoomInfo> Levels(){ return levels_; }

    //Metode ce ofera acces la elementele listei levels_.
    public void AddLevel( ZoomInfo element){
        levels_.add(element);
    }

    public void SetLevel(int index, ZoomInfo element){
        levels_.set(index, element);
    }

    public ZoomInfo Level(int index){ return levels_.get(index); }

    //Metode ce inlocuiesc metodele abstracte din interfata ILayer.
    public ObjectId ID(){ return ID_; }
    public String Name(){ return "Image Layer"; }
    public LayerType Type(){ return LayerType.Image; }
  
    // Pentru debugging.
     @Override
     public String toString() {
        return "ZoomLevels=" + zoomLevels_ + "start=" + start_ + "end=" + end_;
    }
    
}

